home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Loadstar 89
/
089.d81
/
snake source
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2022-08-26
|
8KB
|
257 lines
100 rem snake v1.0 * completed 9/90 * edited 9/6/91 by david caruso ii
110 poke53265,11:dv=peek(186):ifdv<8thendv=8
120 a=2:f4=3
130 poke53272,24:gosub1020
140 poke54272,0:v=54276:t=54273:poke54296,15:a=rnd(ti)
150 c=1:sc=0:f=0:p=0:o=0:poke53280,14:poke53281,0:c5=0:mo=0:ys=0:hx=0:lh=0:sp=bs
160 bo=0:bn=int(rnd(1)*200)+400
170 poke53265,11:gosub1780:poke53265,27
180 goto1070
190 gosub200:goto350
200 poke53280,14
210 poke53265,11:print"[154][147] \snake\ score [211] [255] [146]";:gosub1270
220 a=f:gosub1010:ifa=0thenb$=" "
230 print"";b$;"[146]";:pokev,17:di=0
240 forg=1to23:print" [146] [146]";:poket,g*2
250 next:pokev,16
260 print" [146]":poke2023,160:poke53265,27
270 hb=int(rnd(1)*3)+5
280 cs=7:return
290 ifk=-1ork=1thena=67:goto310
300 a=66
310 sc=sc+1:e=e+1:ife>uthengosub1530
320 return
330 gosub2220:sh=3:ly=int(l/40):lx=l-(ly*40):sp=sp-6:poke1054,160:poke1058,160
340 mf=f:mp=o:f=0:o=0:poke1058,160:goto450
350 a=int(rnd(1)*20)+11:g=int(rnd(1)*9)+8:l=(g*40)+a
360 a=int(rnd(1)*4)+1:k=1:ifa=2thenk=-1
370 ifa=3thenk=40
380 ifa=4thenk=-40
390 gosub890
400 ifsh=0thensc=sc+1:ex=ex+1:poke1024+l,87:poke55296+l,5:e=e+1:ife>uthengosub1530
410 ifdi=1thengosub1680
420 ifmo=1thengosub2300:ifc5=1then1370
430 bo=bo+1:ifbo>bnthengosub1550
440 iflh>1thenlh=lh-1:iflh=1then330
450 iflh=1thengosub290:poke55296+l,c:poke1024+l,a:gosub2150
460 ifp>0thenpokev,17:poket,p:forg=1to1:next:pokev,16
470 a=sc:gosub1010:print"[154]";b$:goto490
480 pokev,17:poket,47:forg=1to1:next:pokev,16:return
490 forg=1tosp:next:geta$:ifa$=""then610
500 if(a$="k"ora$="")andk<>40andk<>-40thenk=40:gosub480:jd=1:goto620
510 if(a$="i"ora$="[145]")andk<>-40andk<>40thenk=-40:gosub480:jd=1:goto620
520 if(a$="l"ora$="")andk<>1andk<>-1thenk=1:gosub480:jd=1:goto620
530 ifa$="s"thengosub1510
540 if(a$="j"ora$="[157]")andk<>-1andk<>1thenk=-1:gosub480:jd=1:goto620
550 ifcs=7anda$=" "then490
560 ifa$=" "andf>0thenpoke53265,11:gosub2480:mo=0:gosub2250:gosub200:goto620
570 if(a$="u"ora$=chr$(13))ando>0ora$="p"ando>0thenp=40:o=o-1:gosub1270:goto620
580 ifa$="-"thensp=sp+2:bs=bs+2:goto620
590 ifa$=chr$(3)thengosub1350
600 ifa$="+"thengosub720
610 cs=0:jy=peek(56320)or128:ifjy<>255then2080
620 gosub830
630 h=peek(k+l+1024):ifh<>32then750
640 ifp=0then660
650 p=p-1:c=int(p/3)+2
660 poke55296+l,c:poke1024+l,de:ifp=0thenc=1:nh=0
670 ifsh=7then1370
680 k2=k:l=l+k:fs=fs+1:iffs=30thenfs=0:gosub920
690 ifpeek(k+l+1024)=87thensp=sp+6:gf=1
700 w=w+1:ifw>hbthen1310
710 goto400
720 sp=sp-2:ifsp<0thensp=0
730 bs=bs-2:ifbs<0thenbs=0
740 return
750 ifh=83thenpoke53280,1:sc=sc+25:goto960
760 ifh=90andp=0andlh<>1then1650
770 ifh>128andh<192then910
780 ifh=94thenpoke53280,1:sc=sc+25:goto1240
790 ifh=87thensh=0:sp=sp+6:lh=0:gosub2230:goto660
800 ifp>0then650
810 ifh=90andlh=1then660
820 sh=7:goto660
830 ifjd=3thenreturn
840 ifjd=2then890
850 jd=2:ifk=1andk2=40ork=-40andk2=-1thende=109:return
860 ifk=40andk2=-1ork=1andk2=-40thende=112:return
870 ifk=-1andk2=40ork=-40andk2=1thende=125:return
880 de=110:return
890 jd=3:ifk=-40ork=40thende=66:return
900 de=67:return
910 sh=7:goto660
920 forg=1to2:pokev,17:poket,20:forh=1to10:next:pokev,16:forh=1to35:next:next
930 a=int(rnd(1)*10)+1:ifa>5then1160
940 a=int(rnd(1)*917)+42:ifpeek(1024+a)=160then920
950 poke55296+a,10:poke1024+a,83:return
960 pokev,33:poket,10:forg=1to15:next:pokev,32
970 iff=1then990
980 f=f+1:a=f:gosub1010:print"";b$
990 poke53280,14:iflh=1thena$=" ":goto560
1000 goto660
1010 b$=str$(a):b$=right$(b$,len(b$)-1):return
1020 f4=5:a=rnd(ti):close8:open15,dv,15:open8,dv,8,"snake file,s,r"
1025 input#8,hs,bs,na$:input#15,a$:close8:f4=0
1030 forg=54272to54296:pokeg,0:next:poke54277,30:poke54278,0:so=1
1040 iflen(na$)=0thenna$="john galt"
1050 ifbs<1thenbs=70
1060 return
1070 geta$:ifa$=""then1070
1080 ifa$="q"then1110
1090 ifa$="[200]"then1180
1100 goto190
1110 printc$;"[145][145][145][145][145][145][145][157][157][157][157][157][157][157][157][157][157][157][157] sure? (y/n)"
1120 geta$:ifa$<>"y"anda$<>"n"then1120
1130 ifa$="y"then2570
1140 printc$;"[145][145][145][145][145][145][145][157][157][157][157][157][157][157][157][157][157][157][157] ";
1150 gosub2050:goto1070
1160 a=int(rnd(1)*917)+42:ifpeek(1024+a)=160then1160
1170 poke55296+a,7:poke1024+a,94:return
1180 rem clear high score
1190 printc$;"[158] \\\ clearing \\\ ";
1200 close15:open15,dv,15:print#15,"s0:snake file":close15
1210 bs=70:hs=100:na$="john galt"
1220 close8:open8,dv,8,"snake file,s,w":print#8,hs:print#8,bs:print#8,na$:close8
1230 gosub2000:goto1070
1240 pokev,33:poket,30:forg=1to15:next:pokev,32
1250 ifo=3then1290
1260 o=o+1:gosub1270:goto1290
1270 a=o:gosub1010:ifa=0thenb$=" "
1280 print"";b$:return
1290 poke53280,14:iflh=1thenpoke198,1:poke631,47
1300 goto660
1310 a=int(rnd(1)*917)+42:ifpeek(1024+a)<>32andck<5thenck=ck+1:goto1310
1320 forg=1to4:ifa=(k*g)+lthenpoke64,206:goto1310
1330 next:ck=0:pokev,17:poket,11:forg=1to10:next:pokev,16
1340 poke1024+a,214:poke55296+a,15:w=0:goto400
1350 geta$:ifa$=""then1350
1360 return
1370 poke53280,2:pokev,129:forg=100to20step-1:poket,g:next:forg=1to10:next:sh=0
1380 a=hx:gosub1010:a$="bonus \"+b$:sc=sc+hx
1390 a=sc:gosub1010:a$=a$+"\ final score \"+b$+"\"
1400 b$=" ":print"[154]";b$
1410 a$=left$(b$,20-int(len(a$)/2))+a$:print"";a$
1420 pokev,128:poket,0:poke54272,0:poke198,0:ifsc>hsthenhs=sc:goto1460
1430 print"[154] (press a key) [146]"
1440 geta$:ifa$=""then1440
1450 goto150
1460 a$="?":print" high score! your name: [157][157][157][157][157][157][157][157][157][157][157]";
1470 gosub1700:na$=m$
1480 close15:open15,dv,15:print#15,"s0:snake file":close15
1490 close8:open8,dv,8,"snake file,s,w":print#8,hs:print#8,bs:print#8,na$:close8
1500 goto1430
1510 ifso=1thenpoke54296,0:so=0:return
1520 so=1:poke54296,15:return
1530 hb=hb-1:e=0:u=int(rnd(1)*30)+90:ifhb<2thenhb=2
1540 return
1550 bn=int(rnd(1)*200)+400:bo=0
1560 a=int(rnd(1)*3)+1:ifa<>2thenreturn
1570 a=int(rnd(1)*1000)+1:ifpeek(1024+a)=32then1600
1580 cr=cr+1:ifcr=6thenreturn
1590 goto1570
1600 cr=0:sl=a:poke1024+a,90:poke55296+a,3:di=1
1610 pokev,17:forg=80to190:poket,g:next:pokev,16:return
1620 iff4=5thenhs=100:na$="john galt":sp=70:close8:f4=0:gosub1030:goto140
1630 iff4=3thengosub1020:goto140
1640 poke53280,0:poke53265,11:forg=1to2000:next:poke186,dv:run
1650 a=53280:pokea,11:sc=sc+500:pokev,17:forg=20to90:poket,g:next:pokea,12:di=0
1660 forg=90to60step-1:poket,g:next:pokea,15
1670 forg=60to130:poket,g:next:pokev,16:pokea,14:goto660
1680 j=j+1:ifj=16thenj=1
1690 poke55296+sl,j:return
1700 m$="":m=0
1710 geta$:ifa$=""then1710
1720 a=asc(a$):ifa=32ora=46then1760
1730 ifa$=chr$(13)andm>0thenreturn
1740 ifa=20andm>0then1770
1750 ifa<65ora>90orm=11then1710
1760 m=m+1:m$=m$+a$:print"";a$;:goto1710
1770 m=m-1:m$=left$(m$,m):print"[157] [157]";:goto1710
1780 ws=1:poke53280,2:print"[158][147] s n a k e ";
1790 print" ";
1800 print" by david caruso ii ";
1810 print" ";
1820 print"[146][155]guide your snake between walls and"
1830 print"rocks. collect special items along"
1840 print"the way. use fire ([150][211][155]) to clear area."
1850 print"bonus is awarded for things burned.
1860 [153]"use power (sys(NULL)list) to pound through all"
1870 [153]"obstacles and collect items. do not"
1880 [153]"lose your mind while playing.":[153]"contfrefrefrefrefrefrefrefre"
1890 [153]" points wait def(NULL)cont..25 sys(NULL)cont..25 print(NULL)cont..500 openspc(cont..?":[153]"pospospospospospospospos"
1900 [153]" keys to use wait";
1910 [153]"pospospospospos pospospospospospospospospospospos"
1920 [153]" [i] wait listnorth [space] wait liststart fire"
1930 [153]" [k] wait listsouth [u] [p] wait listuse power"
1940 [153]" [j] wait listwest [s